<% navigation_links = Rails.cache.fetch("navigation_links", expires_in: 15.minutes) do
     {
       default_nav_ids: NavigationLink.from_subforem.default_section.ordered.ids,
       other_nav_ids: NavigationLink.from_subforem.other_section.ordered.ids
     }
   end %>


<footer id="footer" class="crayons-footer print-hidden">
  <div id="footer-container" class="crayons-footer__container">


    <% cache "footer-billboard-#{user_signed_in?}-#{request.host}", expires_in: 3.minutes do %>
      <% footer_billboard = Billboard.for_display(area: "footer", user_signed_in: user_signed_in?) %>
      <% if footer_billboard %>
        <%= render partial: "shared/billboard", locals: { billboard: footer_billboard, data_context_type: BillboardEvent::CONTEXT_TYPE_HOME } %>
      <% end %>
    <% end %>

    <p class="fs-s crayons-footer__description">
      <%= t("views.main.footer.desc_html", community: link_to(community_name, root_path, class: "c-link c-link--branded fw-medium", "aria-label": t("views.main.aria_home", community: community_name)), desc: Settings::Community.community_description) %>
    </p>

    <ul class="footer__nav-links flex gap-2 justify-center flex-wrap fs-s p-0" style="" />
      <%= render partial: "layouts/nav_link", collection: NavigationLink.from_subforem.where(id: navigation_links[:default_nav_ids]).ordered, as: :link, cached: true %>
    </ul>

    <ul class="footer__nav-links flex gap-2 justify-center flex-wrap fs-s p-0" style="" />
      <%= render partial: "layouts/nav_link", collection: NavigationLink.from_subforem.where(id: navigation_links[:other_nav_ids]).ordered, as: :link, cached: true %>
    </ul>

    <div class="fs-s">
      <%# The following copy is necessary for compatibility with the Forem AGPL licence which requires instances to link back to the source. %>
      <p><%= t("views.main.footer.built.text_html",
               forem: link_to(t("views.main.footer.built.forem"), "https://www.forem.com", class: "c-link c-link--branded", target: "_blank", rel: "noopener"),
               opensource: link_to(t("views.main.footer.built.opensource"), "https://dev.to/t/opensource", target: "_blank", rel: "noopener", class: "c-link c-link--branded"),
               dev: link_to(t("views.main.footer.built.dev"), "https://dev.to", target: "_blank", rel: "noopener", class: "c-link c-link--branded")) %></p>
      <p><%= t("views.main.footer.powered.text_html",
               rails: link_to(t("views.main.footer.powered.rails"), "https://dev.to/t/rails", target: "_blank", rel: "noopener", class: "c-link c-link--branded"),
               community: community_name,
               copyright: copyright_notice) %></p>
    </div>
  </div>
</footer>
<div id="snack-zone"></div>
